package com.cuixichang.minimalism.controller;

import com.cuixichang.minimalism.basal.base.Result;
import com.cuixichang.minimalism.core.mybatis.utils.CodeGeneratorUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/code")
@Api(tags = {"代码生成管理模块"})
public class CodeGeneratorController {

    @Autowired
    private CodeGeneratorUtil codeGeneratorUtil;

    @GetMapping("/generate")
    @ApiOperation(value = "代码生成")
    public Result<String> generateCode(@RequestParam("映射数据库表名") String tableName,@RequestParam("作者名")  String author) {
        codeGeneratorUtil.execute(tableName, author);
        return Result.ok("业务服务生成完成",null);
    }
}
